<template>
  <div class="app-container home">
    <div class="home-title">数据概览</div>
    <div class="home-row1">
        <div class="home-row1-li">
          <div class="home-row1-li-left">
            <div class="home-row1-li-left-title">{{ dataLink.row1Data1.title }}</div>
            <div class="home-row1-li-left-num">{{ dataLink.row1Data1.num }}</div>
            <div class="home-row1-li-left-tips" :style="{color:dataLink.row1Data1.tip == '增长'?'#16A34A':'#DC2626'}">
              <img src="../.././src/assets/images/rise.png" alt="" v-if="dataLink.row1Data1.tip == '增长'">
              <img src="../.././src/assets/images/decline.png" alt="" v-if="dataLink.row1Data1.tip == '下降'">
              <span>{{dataLink.row1Data1.growthRate}} {{dataLink.row1Data1.tip}}</span>
            </div>
          </div>
          <div class="home-row1-li-right" style="background-color: #6366F1">
            <img src="../.././src/assets/images/school.png" alt="">
          </div>
        </div>
        <div class="home-row1-li">
          <div class="home-row1-li-left">
            <div class="home-row1-li-left-title">{{ dataLink.row1Data2.title }}</div>
            <div class="home-row1-li-left-num">{{ dataLink.row1Data2.num }}</div>
            <div class="home-row1-li-left-tips" :style="{color:dataLink.row1Data2.tip == '增长'?'#16A34A':'#DC2626'}">
              <img src="../.././src/assets/images/rise.png" alt="" v-if="dataLink.row1Data2.tip == '增长'">
              <img src="../.././src/assets/images/decline.png" alt="" v-if="dataLink.row1Data2.tip == '下降'">
              <span>{{dataLink.row1Data2.growthRate}} {{dataLink.row1Data2.tip}}</span>
            </div>
          </div>
          <div class="home-row1-li-right" style="background-color: #3B82F6">
            <img src="../.././src/assets/images/course.png" alt="">
          </div>
        </div>
        <div class="home-row1-li">
          <div class="home-row1-li-left">
            <div class="home-row1-li-left-title">{{ dataLink.row1Data3.title }}</div>
            <div class="home-row1-li-left-num">{{ dataLink.row1Data3.num }}</div>
            <div class="home-row1-li-left-tips" :style="{color:dataLink.row1Data3.tip == '增长'?'#16A34A':'#DC2626'}">
              <img src="../.././src/assets/images/rise.png" alt="" v-if="dataLink.row1Data3.tip == '增长'">
              <img src="../.././src/assets/images/decline.png" alt="" v-if="dataLink.row1Data3.tip == '下降'">
              <span>{{dataLink.row1Data3.growthRate}} {{dataLink.row1Data3.tip}}</span>
            </div>
          </div>
          <div class="home-row1-li-right" style="background-color: #22C55E">
            <img src="../.././src/assets/images/RegistTeacher.png" alt="">
          </div>
        </div>
        <div class="home-row1-li">
          <div class="home-row1-li-left">
            <div class="home-row1-li-left-title">{{ dataLink.row1Data4.title }}</div>
            <div class="home-row1-li-left-num">{{ dataLink.row1Data4.num }}</div>
            <div class="home-row1-li-left-tips" :style="{color:dataLink.row1Data4.tip == '增长'?'#16A34A':'#DC2626'}">
              <img src="../.././src/assets/images/rise.png" alt="" v-if="dataLink.row1Data4.tip == '增长'">
              <img src="../.././src/assets/images/decline.png" alt="" v-if="dataLink.row1Data4.tip == '下降'">
              <span>{{dataLink.row1Data4.growthRate}} {{dataLink.row1Data4.tip}}</span>
            </div>
          </div>
          <div class="home-row1-li-right" style="background-color: #EAB308">
            <img src="../.././src/assets/images/student.png" alt="">
          </div>
        </div>
      </div>
    <div class="home-row2">
      <div class="home-row2-li">
        <div class="home-row2-li-title">课程分布</div>
        <div class="home-row2-li-content">
          <pie-echarts :id ='echarts1' />
        </div>
      </div>
      <div class="home-row2-li">
        <div class="home-row2-li-title">学校类型分布</div>
        <div class="home-row2-li-content">
          <pie-echarts1 :id ='echarts1' />
        </div>
      </div>
      <div class="home-row2-li">
        <div class="home-row2-li-title">资源库资源类别分布</div>
        <div class="home-row2-li-content">
          <pie-echarts1 :id ='echarts2' />
        </div>
      </div>
    </div>
    <div class="home-row3">
      <div class="home-row3-li" style="font-size: 18px">最近活动</div>
      <div class="home-row3-li" v-for="item in dataLink.newActive" :key="item.id">
        <div class="home-row3-li-content">
          <div class="home-row3-li-content-left">
            <img :src="item.headImg" alt="">
          </div>
          <div class="home-row3-li-content-right">
            <div style="font-size: 14px;color: #111827">{{item.name}}</div>
            <div style="font-size: 14px;color: #6B7280">{{item.content}}</div>
            <div style="font-size: 14px;color: #9CA3AF">{{ item.time }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import pieEcharts from "@/views/components/pieEcharts/index.vue";
import pieEcharts1 from "@/views/components/pieEcharts1/index.vue";
export default {
  name: "Index",
  data() {
    return {
      dataLink:{
        title:'数据概览',
        row1Data1:{title:'校企合作',num:128,tip:'增长',growthRate:'12.5%'},
        row1Data2:{title:'在授课程',num:345,tip:'增长',growthRate:'8.5%'},
        row1Data3:{title:'注册教师',num:1284,tip:'增长',growthRate:'12.5%'},
        row1Data4:{title:'学员总数',num:12869,tip:'下降',growthRate:'2.5%'},
        newActive:[
          {id:1,name:'李校长',content:'更新了 阳光小学 的课程设置',time:'10分钟前',headImg:''},
          {id:2,name:'王老师',content:'上传了新的篮球教学视频',time:'18分钟前',headImg:''},
          {id:3,name:'张教授',content:'提交了新的排课申请',time:'23分钟前',headImg:''},
          {id:4,name:'系统',content:'完成了数据备份',time:'32分钟前',headImg:''},
          {id:5,name:'王老师',content:'上传了新的篮球教学视频',time:'55分钟前',headImg:''},
          {id:6,name:'张教授',content:'提交了新的排课申请',time:'1小时前',headImg:''},
          {id:7,name:'张教授',content:'提交了新的排课申请1111',time:'2小时前',headImg:''},
        ]
      }

    };
  },
  components:{
    pieEcharts,
    pieEcharts1,
  },
  methods: {

  },
};
</script>

<style scoped lang="scss">
.home{
  width: 100%;
  height: 100%;
  background: #F9FAFB;
  overflow: auto;
  .home-title{
    font-size: 24px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 24px;
  }
  .home-row1{
    width: 100%;
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    .home-row1-li{
      width: calc((100% - 72px) / 4);
      padding: 24px;
      box-sizing: border-box;
      border-radius: 8px;
      background-color: #FFFFFF;
      margin-right: 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1),0px 1px 3px 0px rgba(0, 0, 0, 0.1);
      .home-row1-li-left-title{
        font-size: 14px;
        color: #6B7280;
      }
      .home-row1-li-left-num{
        font-size: 30px;
        font-weight: bold;
        color: #111827;
        margin: 4px 0;
      }
      .home-row1-li-left-tips{
        font-size: 14px;
        img{
          width: 10.5px;
          height: 14px;
          margin-right: 5px;
        }
      }
      .home-row1-li-right{
        width: 49px;
        height: 52px;
        border-radius: 50%;
        padding: 12px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        img{
          height: 20px;
        }
      }
    }
    .home-row1-li:nth-child(4){
      margin-right: 0;
    }
  }
  .home-row2{
    width: 100%;
    display: flex;
    align-items: center;
    .home-row2-li{
      width: calc((100% - 48px) / 3);
      padding: 24px;
      box-sizing: border-box;
      border-radius: 8px;
      background-color: #FFFFFF;
      margin-right: 24px;
      display: flex;
      flex-direction: column;
      box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1),0px 1px 3px 0px rgba(0, 0, 0, 0.1);
      .home-row2-li-title{
        font-size: 18px;
        color: #111827;
        margin-bottom: 50px;
      }
      .home-row2-li-content{
        flex: 1;
      }
    }
    .home-row2-li:nth-child(3){
      margin-right: 0;
    }
  }
  .home-row3{
    width: 100%;
    margin-top: 32px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 1px 2px -1px rgba(0, 0, 0, 0.1),0px 1px 3px 0px rgba(0, 0, 0, 0.1);
    .home-row3-li{
      padding: 16px 24px;
      box-sizing: border-box;
      border-bottom: 1px solid #E5E7EB;
      .home-row3-li-content{
        width: 100%;
        display: flex;
        align-items: center;
        .home-row3-li-content-left{
          width: 40px;
          height: 40px;
          border-radius: 50%;
          background-color: palegoldenrod;
          margin-right: 16px;
          img{
            width: 100%;
            height: 100%;
          }
        }
      }
    }
  }
}
</style>

